package com.chengjue.elasticsearch.model;

import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "resource", type = "resources")
public class Resource {
    private Long id;

    @Field(type = FieldType.text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String name;

    private String type;

    private Date createTime;
    private Date updateTime;

    private String url;

    private Integer readNumber;
    private Integer likeNumber;

    @Field(type = FieldType.text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String content;

    @Field(type = FieldType.text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String writer;
    private String resource;

    private Date publishTime;

    public Long getId() {
        return id;
    }


    public void setId(Long id) {
        this.id = id;
    }


    public String getName() {
        return name;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.name
     *
     * @param name the value for t_resource.name
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.type
     *
     * @return the value of t_resource.type
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public String getType() {
        return type;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.type
     *
     * @param type the value for t_resource.type
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.create_time
     *
     * @return the value of t_resource.create_time
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.create_time
     *
     * @param createTime the value for t_resource.create_time
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.update_time
     *
     * @return the value of t_resource.update_time
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public Date getUpdateTime() {
        return updateTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.update_time
     *
     * @param updateTime the value for t_resource.update_time
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.url
     *
     * @return the value of t_resource.url
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public String getUrl() {
        return url;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.url
     *
     * @param url the value for t_resource.url
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setUrl(String url) {
        this.url = url == null ? null : url.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.read_number
     *
     * @return the value of t_resource.read_number
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public Integer getReadNumber() {
        return readNumber;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.read_number
     *
     * @param readNumber the value for t_resource.read_number
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setReadNumber(Integer readNumber) {
        this.readNumber = readNumber;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.like_number
     *
     * @return the value of t_resource.like_number
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public Integer getLikeNumber() {
        return likeNumber;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.like_number
     *
     * @param likeNumber the value for t_resource.like_number
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setLikeNumber(Integer likeNumber) {
        this.likeNumber = likeNumber;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.content
     *
     * @return the value of t_resource.content
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public String getContent() {
        return content;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.content
     *
     * @param content the value for t_resource.content
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.writer
     *
     * @return the value of t_resource.writer
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public String getWriter() {
        return writer;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.writer
     *
     * @param writer the value for t_resource.writer
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setWriter(String writer) {
        this.writer = writer == null ? null : writer.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.resource
     *
     * @return the value of t_resource.resource
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public String getResource() {
        return resource;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.resource
     *
     * @param resource the value for t_resource.resource
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setResource(String resource) {
        this.resource = resource == null ? null : resource.trim();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column t_resource.publish_time
     *
     * @return the value of t_resource.publish_time
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public Date getPublishTime() {
        return publishTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column t_resource.publish_time
     *
     * @param publishTime the value for t_resource.publish_time
     * @mbg.generated Mon Apr 23 15:04:31 CST 2018
     */
    public void setPublishTime(Date publishTime) {
        this.publishTime = publishTime;
    }

    @Override
    public String toString() {
        return "Resource{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", url='" + url + '\'' +
                ", readNumber=" + readNumber +
                ", likeNumber=" + likeNumber +
                ", content='" + content + '\'' +
                ", writer='" + writer + '\'' +
                ", resource='" + resource + '\'' +
                ", publishTime=" + publishTime +
                '}';
    }
}